package com.cn.utils;

import com.cn.pojo.TzCategory;

import java.io.Serializable;
import java.util.List;


public class Result<T> implements Serializable {
    private Integer code;
    private String msg;
    private Object data;

    public static<T> Result<T> success(Object data){
        Result result = new Result<>();
        result.setCode(ResponseEnum.SUCCESSCODE.getCode());
        result.setMsg(ResponseEnum.SUCCESSCODE.getMsg());
        result.setData(data);
        return  result;
    }

    public static<T> Result<T> error(){
        Result result = new Result<>();
        result.setCode(ResponseEnum.FAIL.getCode());
        result.setMsg(ResponseEnum.FAIL.getMsg());
        return  result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
